<!DOCTYPE html>
<html dir="ltr" lang="zh_cn"><!--<![endif]--><head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" >
    <title></title>

    <link href="https://mall.opencart.cn/catalog/view/javascript/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://mall.opencart.cn/catalog/view/javascript/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="https://mall.opencart.cn/catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css" type="text/css" rel="stylesheet" media="screen">

    <link href="https://mall.opencart.cn/catalog/view/theme/mobile/stylesheet/stylesheet.css" rel="stylesheet">

</head>
<body class="checkout-checkout-address_form" ontouchstart="" onmouseover="">



<div class="container">
    <div class="row">
        <div class="col-sm-12">
            <form id="address-form" class="form-horizontal mt-1 mb-1">
                <fieldset>
                    <!-- fullname -->
                    <div class="form-group required">
                        <label class="col-sm-2 control-label" for="input-fullname">您的姓名</label>
                        <div class="col-sm-10">
                            <input type="text" name="fullname" value="" placeholder="您的姓名*" id="input-fullname" class="form-control">
                        </div>
                    </div>

                    <!-- telephone -->
                    <div class="form-group required">
                        <label class="col-sm-2 control-label" for="input-telephone">联系电话</label>
                        <div class="col-sm-10">
                            <input type="text" name="telephone" value="" placeholder="联系电话*" id="input-telephone" class="form-control">
                        </div>
                    </div>

                    <!-- company -->
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="input-company">公司名称</label>
                        <div class="col-sm-10">
                            <input type="text" name="company" value="" placeholder="公司名称" id="input-company" class="form-control">
                        </div>
                    </div>

                    <!-- City -->

                    <!-- Location -->
                    <div class="form-group required">
                        <label class="col-sm-2 control-label" for="input-zone">区域</label>
                        <div class="col-sm-10">
                            <div class="row">

                                <div class="col-sm-3 hidden">
                                    <select name="country_id" id="input-country" class="form-control">
                                        <option value=""> --- 请选择 --- </option>
                                        <option value="44" selected="selected">中国</option>
                                    </select>
                                </div>

                                <div class="col-sm-3">
                                    <select name="zone_id" id="input-zone" class="form-control"><option value=""> --- 请选择 --- </option><option value="708">上海市</option><option value="713">云南省</option><option value="699">内蒙古自治区</option><option value="685" selected="selected">北京市</option><option value="4237">台湾省</option><option value="702">吉林省</option><option value="710">四川省</option><option value="711">天津市</option><option value="705">宁夏回族自治区</option><option value="684">安徽省</option><option value="707">山东省</option><option value="706">山西省</option><option value="689">广东省</option><option value="690">广西壮族自治区</option><option value="712">新疆维吾尔自治区</option><option value="700">江苏省</option><option value="701">江西省</option><option value="693">河北省</option><option value="695">河南省</option><option value="714">浙江省</option><option value="692">海南省</option><option value="697">湖北省</option><option value="698">湖南省</option><option value="704">澳门特别行政区</option><option value="688">甘肃省</option><option value="687">福建省</option><option value="4236">西藏自治区</option><option value="691">贵州省</option><option value="703">辽宁省</option><option value="686">重庆市</option><option value="709">陕西省</option><option value="4232">青海省</option><option value="696">香港特别行政区</option><option value="694">黑龙江省</option></select>
                                </div>

                                <div class="col-sm-3">
                                    <select name="city_id" id="input-city" class="form-control"><option value=""> --- 请选择 --- </option><option value="3405">市辖区</option></select>
                                </div>

                                <div class="col-sm-3">
                                    <select name="county_id" id="input-county" class="form-control"><option value=""> --- 请选择 --- </option><option value="0" selected="selected"> --- 无 --- </option></select>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Address 1 -->
                    <div class="form-group required">
                        <label class="col-sm-2 control-label" for="input-address-1">详细地址</label>
                        <div class="col-sm-10">
                            <input type="text" name="address_1" value="" placeholder="详细地址*" id="input-address-1" class="form-control">
                        </div>
                    </div>

                    <!-- Address 2 -->
                    <div class="form-group hidden">
                        <label class="col-sm-2 control-label" for="input-address-2">详细地址2</label>
                        <div class="col-sm-10">
                            <input type="text" name="address_2" value="" placeholder="详细地址2" id="input-address-2" class="form-control">
                        </div>
                    </div>

                    <!-- Postcode -->
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="input-postcode">邮政编码</label>
                        <div class="col-sm-10">
                            <input type="text" name="postcode" value="123123" placeholder="邮政编码*" id="input-postcode" class="form-control">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">默认地址</label>
                        <div class="col-sm-10">
                            <label class="radio-inline">
                                <input type="radio" name="default" value="1">
                                是
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="default" value="0" checked="checked">
                                否
                            </label>
                        </div>
                    </div>
                    <button id="button-submit" type="button" data-loading-text="正在加载..." class="btn btn-primary btn-block">提交</button>
                </fieldset>
            </form>
        </div>
    </div>
</div>

<script type="text/javascript"><!--
// Sort the custom fields
$('.form-group[data-sort]').detach().each(function() {
    if ($(this).attr('data-sort') >= 0 && $(this).attr('data-sort') <= $('.form-group').length) {
        $('.form-group').eq(parseInt($(this).attr('data-sort'))).before(this);
    }

    if ($(this).attr('data-sort') > $('.form-group').length) {
        $('.form-group:last').after(this);
    }

    if ($(this).attr('data-sort') == $('.form-group').length) {
        $('.form-group:last').after(this);
    }

    if ($(this).attr('data-sort') < -$('.form-group').length) {
        $('.form-group:first').before(this);
    }
});
//--></script>
<script type="text/javascript"><!--
$('button[id^=\'button-custom-field\']').on('click', function() {
    var element = this;

    $('#form-upload').remove();

    $('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>');

    $('#form-upload input[name=\'file\']').trigger('click');

    if (typeof timer != 'undefined') {
        clearInterval(timer);
    }

    timer = setInterval(function() {
        if ($('#form-upload input[name=\'file\']').val() != '') {
            clearInterval(timer);

            $.ajax({
                url: 'index.php?route=tool/upload',
                type: 'post',
                dataType: 'json',
                data: new FormData($('#form-upload')[0]),
                cache: false,
                contentType: false,
                processData: false,
                beforeSend: function() {
                    $(element).button('loading');
                },
                complete: function() {
                    $(element).button('reset');
                },
                success: function(json) {
                    $(element).parent().find('.text-danger').remove();

                    if (json['error']) {
                        $(element).parent().find('input').after('<div class="text-danger">' + json['error'] + '</div>');
                    }

                    if (json['success']) {
                        alert(json['success']);

                        $(element).parent().find('input').val(json['code']);
                    }
                },
                error: function(xhr, ajaxOptions, thrownError) {
                    alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
                }
            });
        }
    }, 500);
});
//--></script>
<script type="text/javascript"><!--
$('.date').datetimepicker({
    language: 'en-gb',
    pickTime: false
});

$('.datetime').datetimepicker({
    language: 'en-gb',
    pickDate: true,
    pickTime: true
});

$('.time').datetimepicker({
    language: 'en-gb',
    pickDate: false
});
//--></script>
<script type="text/javascript"><!--
$('select[name=\'country_id\']').on('change', function() {
    $.ajax({
        url: 'index.php?route=account/account/country&country_id=' + this.value,
        dataType: 'json',
        beforeSend: function() {
            $('select[name=\'country_id\']').prop('disabled', true);
        },
        complete: function() {
            $('select[name=\'country_id\']').prop('disabled', false);
        },
        success: function(json) {
            if (json['postcode_required'] == '1') {
                $('input[name=\'postcode\']').parent().parent().addClass('required');
            } else {
                $('input[name=\'postcode\']').parent().parent().removeClass('required');
            }

            html = '<option value=""> --- 请选择 --- </option>';

            if (json['zone'] && json['zone'] != '') {
                for (i = 0; i < json['zone'].length; i++) {
                    html += '<option value="' + json['zone'][i]['zone_id'] + '"';

                    if (json['zone'][i]['zone_id'] == '685') {
                        html += ' selected="selected"';
                    }

                    html += '>' + json['zone'][i]['name'] + '</option>';
                }
            } else {
                html += '<option value="0" selected="selected"> --- 无 --- </option>';
            }

            $('select[name=\'zone_id\']').html(html);
            $('select[name=\'city_id\']').html('<option> --- 请选择 --- </option>');
            $('select[name=\'county_id\']').html('<option> --- 请选择 --- </option>');
            $('select[name=\'zone_id\']').trigger('change');
        },
        error: function(xhr, ajaxOptions, thrownError) {
            alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
        }
    });
});
$('select[name=\'country_id\']').trigger('change');
//--></script>

<script type="text/javascript"><!--
var showCityOrCountyOptions = function(currentEl, changeEl, isTop, cityId, callback) {
    var zoneId = currentEl.val();
    if (zoneId == null) return;
    var requestUrl = 'index.php?route=account/account/zone&zone_id=' + zoneId + '&is_top=' + isTop;
    $.ajax({
        url: requestUrl,
        dataType: 'json',
        beforeSend: function () {
            $('select[name=\'city_id\']').prop('disabled', true);
            $('select[name=\'county_id\']').prop('disabled', true);
        },
        complete: function () {
            $('select[name=\'city_id\']').prop('disabled', false);
            $('select[name=\'county_id\']').prop('disabled', false);
        },
        success: function (json) {
            html = '<option value=""> --- 请选择 --- </option>';
            if (json['city'] && json['city'] != '') {
                for (i = 0; i < json['city'].length; i++) {
                    html += '<option value="' + json['city'][i]['city_id'] + '"';
                    if (json['city'][i]['city_id'] == cityId) {
                        html += ' selected="selected"';
                    }
                    html += '>' + json['city'][i]['name'] + '</option>';
                }
            } else {
                html += '<option value="0" selected="selected"> --- 无 --- </option>';
            }
            changeEl.html(html);
            if (typeof(callback) == 'function') {
                callback();
            }
        },
        error: function (xhr, ajaxOptions, thrownError) {
            alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
        }
    });
};

$('select[name=\'zone_id\']').bind('change', function() {
    var changeEl = $('select[name=\'city_id\']');
    var cityId = '';
    showCityOrCountyOptions($(this), changeEl, 1, cityId, function() {
        changeEl.trigger('change');
    });
});

$('select[name=\'city_id\']').bind('change', function() {
    var changeEl = $('select[name=\'county_id\']');
    var countyId = '';
    showCityOrCountyOptions($(this), changeEl, 0, countyId);
});
//--></script>

<script type="text/javascript"><!--
$('#button-submit').on('click', function () {
    $.ajax({
        url: 'index.php?route=checkout/checkout/save_address&type=shipping&address_id=' + 0,
        type: 'post',
        data: $('#address-form input[type=\'text\'], #address-form input[type=\'date\'], #address-form input[type=\'datetime-local\'], #address-form input[type=\'time\'], #address-form input[type=\'password\'], #address-form input[type=\'checkbox\']:checked, #address-form input[type=\'radio\']:checked, #address-form textarea, #address-form select'),
        dataType: 'json',
        beforeSend: function() {
            $('.form-group').removeClass('has-error');
            $('.alert-danger').remove();
            $('.help-block').remove();
            $('#button-submit').button('loading');
            $('#address-form .alert-danger').remove();
        },
        success: function(json) {
            if (json['redirect']) {
                location = json['redirect'];
                return;
            }

            if (json['error']) {
                $('#button-submit').button('reset');
                $.each(json['error'], function (key, value) {
                    if (key.indexOf('custom_field') === 0) {
                        var control = $('#address-form [name^="custom_field[address][' + key.replace('custom_field_', '') + ']"]').first();
                    } else {
                        var control = $('#address-form [name="' + key + '"]').first();
                    }

                    control.closest('.form-group').addClass('has-error');
                    control.closest("div[class^='col-']").append('<span class="help-block">' + value + '</span>');
                });

                if (json['error']['warning']) {
                    $('#address-form').append('<div class="alert alert-danger">' + json['error']['warning'] + '</div>')
                }

                return;
            }

            // Address saved, close current window
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        },
        error: function(xhr, ajaxOptions, thrownError) {
        }
    });
})
//--></script>





</body></html>